import { defineStore } from "pinia";
import { ref } from "vue";

export const useOrderStore = defineStore('order', () => {

  const createOrderParams = ref()

  const setCreateOrderParams = (data) => {
    createOrderParams.value = data
  }

  const clearCreateOrderParams = () => {
    createOrderParams.value = undefined
  }

  return {
    createOrderParams,
    setCreateOrderParams,
    clearCreateOrderParams
  }
},
  {
    persist: {
      storage: {
        getItem (key) {
          return uni.getStorageSync(key)
        },
        setItem (key, value) {
          uni.setStorageSync(key, value)
        },
      }
    }
  })

